﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Nova.Parsing.GoldParser.Semantic;
using Nova.Parsing.Tokens;

namespace Nova.Parsing.Constructs
{
    public sealed class RegisterVariableConstruct : VariableConstruct
    {
        private string m_RegisterName;
        private ExpressionConstruct m_RegisterIndex;

        [Rule(@"<Register Iden> ::= '$' Identifier '[' <Expression> ']'")]
        [Rule(@"<Register Iden> ::= '$' Identifier")]
        public RegisterVariableConstruct(IgnoredToken iA, Identifier regName, IgnoredToken iB, ExpressionConstruct index, IgnoredToken iC)
        {
            m_RegisterName = regName.Value as string;
            m_RegisterIndex = index;
        }

        public string RegisterName
        {
            get { return m_RegisterName; }
        }

        public ExpressionConstruct RegisterIndex
        {
            get { return m_RegisterIndex; }
        }
    }
}
